-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: broadcast dsq messages using the inventory system #6148
feat: broadcast dsq messages using the inventory system #6148
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls see a few thoughts/suggestions below + linter is complaining
7a4f608
to
db59b0b
Compare
rebased on develop |
@UdjinM6 can you re-review based on latest? |
any thoughts on my previous comments? #6148 (review) |
@UdjinM6 what do you mean? I thought I applied all concepts, didn't fix linter yet. Is that all you mean? |
Weird... Had to reload a couple of times to see new changes 🤷♂️ |
@UdjinM6 please re-review |
src/version.h
Outdated
@@ -55,6 +55,9 @@ static const int MNLISTDIFF_CHAINLOCKS_PROTO_VERSION = 70230; | |||
//! Legacy ISLOCK messages and a corresponding INV were dropped in this version | |||
static const int NO_LEGACY_ISLOCK_PROTO_VERSION = 70231; | |||
|
|||
//! Inventory type for DSQ messages added | |||
static const int DSQ_INV_VERSION = 70233; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
21.1 nodes get "unknown inv" and can't mix, we need a proto bump (70233 is 21.1)
doc/release-notes-6148.md
Outdated
P2P and Network Changes | ||
----------------------- | ||
|
||
The DSQ message, starting in protocol version 70233, is broadcast using the inventory system, and not simply |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DSQ message, starting in protocol version 70233, is broadcast using the inventory system, and not simply | |
The DSQ message, starting in protocol version 70234, is broadcast using the inventory system, and not simply |
also, clang-format isn't happy :) |
e85a31e
to
d6b49a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't compile, pls see 7170f0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 7170f0e
nit: clang format complains again 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 9d8bbd3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 9d8bbd3
@@ -47,6 +48,11 @@ PeerMsgRet CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CDataS | |||
CCoinJoinQueue dsq; | |||
vRecv >> dsq; | |||
|
|||
{ | |||
LOCK(cs_main); | |||
Assert(peerman)->EraseObjectRequest(peer.GetId(), CInv(MSG_DSQ, dsq.GetHash())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if by any reason CCoinJoinClientQueueManager
will be initialized before peerman
?
Should we just change assert here to if?
Assert(peerman)->EraseObjectRequest(peer.GetId(), CInv(MSG_DSQ, dsq.GetHash())); | |
if (peerman) peerman->EraseObjectRequest(peer.GetId(), CInv(MSG_DSQ, dsq.GetHash())); |
@@ -87,10 +87,11 @@ EXPECTED_CIRCULAR_DEPENDENCIES=( | |||
"evo/deterministicmns -> validationinterface -> evo/deterministicmns" | |||
"logging -> util/system -> sync -> logging/timer -> logging" | |||
|
|||
"coinjoin/client -> net_processing -> coinjoin/client" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you avoid adding new circulat dependencies?
These 2 disappeared just because they have shorter path between coinjoin/client.... coinjoin/client
"coinjoin/client -> coinjoin/util -> wallet/wallet -> psbt -> node/transaction -> node/context -> coinjoin/context -> coinjoin/client"
"coinjoin/client -> coinjoin/coinjoin -> llmq/chainlocks -> net_processing -> coinjoin/client"
DSQ messages are 142 bytes. Previously, assuming a relatively highly connected masternode hosting 100 connection, each round of coinjoin will result in 14.2KB (100*142) of inbound and outbound traffic each. Now, using the inventory system, a message will first use 36 bytes per peer (sending and receiving), plus the size of a `getdata` message and the actual message itself. As a result, bandwidth usage for 1 round of mixing would be closer to 36 * 100 + 142 (dsq) + 36 (getdata) = ~3.8KB, a reduction of around ~73%
9d8bbd3
to
57fb087
Compare
Woah, where's the DIP for this? Who voted to change the CoinJoin protocol? I'm just about done with the Web CoinJoin wallet and y'all are changing protocols without any specs or voting? |
…t processing / peerman dafa736 fix: respect SENDDSQUEUE message, move DSQ relay into net processing / peerman (pasta) Pull request description: ## Issue being fixed or feature implemented in #6148, I broke the functionality where a peer must opt in / opt out of DSQUEUE messages. This was mostly ok, and not immediately detected, as with this bug, simply everyone would receive DSQ messages over inventory (or classically, old proto versions were not affected by this bug). But this still would result in quite a bit of wasted bandwidth for peers which may not care about DSQ at all. ## What was done? This commit should restore the prior functionality, where a node should send the SENDDSQUEUE message if they wish to receive DSQs. Once they've sent that, depending on their protocol version, they will either have the messages pushed to them as available, or on modern protocols, they will thereafter receive DSQs over the inventory system. NOTE: I also refactor the code in this commit, moving some network proccessing into.... wait for it... net_processing.cpp! This allowed us to remove some dependencies in coinjoin.h. DSQ messages are now relayed to peers by calling peer_manager.RelayDSQ ## How Has This Been Tested? I have not yet mixed on testnet with this; we should include it in rc.2 and test ## Breaking Changes Slightly breaking for v22.0.x (so rc.1), as they in theory could be relying on this new logic of always receiving the DSQ inv. But I don't think anyone besides core is using this new protocol. ## Checklist: _Go over all the following points, and put an `x` in all the boxes that apply._ - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: UdjinM6: light ACK dafa736 kwvg: utACK dafa736 Tree-SHA512: 18f9b0dfe05cde19db451653db9bb9a00352efd1bc37adffd83f74958010475f2782b1111b1c0d2dd967e7a851c3c4795fa55033b4bd0cc810aa293e754ce314
…into net processing / peerman dafa736 fix: respect SENDDSQUEUE message, move DSQ relay into net processing / peerman (pasta) Pull request description: ## Issue being fixed or feature implemented in dashpay#6148, I broke the functionality where a peer must opt in / opt out of DSQUEUE messages. This was mostly ok, and not immediately detected, as with this bug, simply everyone would receive DSQ messages over inventory (or classically, old proto versions were not affected by this bug). But this still would result in quite a bit of wasted bandwidth for peers which may not care about DSQ at all. ## What was done? This commit should restore the prior functionality, where a node should send the SENDDSQUEUE message if they wish to receive DSQs. Once they've sent that, depending on their protocol version, they will either have the messages pushed to them as available, or on modern protocols, they will thereafter receive DSQs over the inventory system. NOTE: I also refactor the code in this commit, moving some network proccessing into.... wait for it... net_processing.cpp! This allowed us to remove some dependencies in coinjoin.h. DSQ messages are now relayed to peers by calling peer_manager.RelayDSQ ## How Has This Been Tested? I have not yet mixed on testnet with this; we should include it in rc.2 and test ## Breaking Changes Slightly breaking for v22.0.x (so rc.1), as they in theory could be relying on this new logic of always receiving the DSQ inv. But I don't think anyone besides core is using this new protocol. ## Checklist: _Go over all the following points, and put an `x` in all the boxes that apply._ - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: UdjinM6: light ACK dafa736 kwvg: utACK dafa736 Tree-SHA512: 18f9b0dfe05cde19db451653db9bb9a00352efd1bc37adffd83f74958010475f2782b1111b1c0d2dd967e7a851c3c4795fa55033b4bd0cc810aa293e754ce314
…into net processing / peerman dafa736 fix: respect SENDDSQUEUE message, move DSQ relay into net processing / peerman (pasta) Pull request description: ## Issue being fixed or feature implemented in dashpay#6148, I broke the functionality where a peer must opt in / opt out of DSQUEUE messages. This was mostly ok, and not immediately detected, as with this bug, simply everyone would receive DSQ messages over inventory (or classically, old proto versions were not affected by this bug). But this still would result in quite a bit of wasted bandwidth for peers which may not care about DSQ at all. ## What was done? This commit should restore the prior functionality, where a node should send the SENDDSQUEUE message if they wish to receive DSQs. Once they've sent that, depending on their protocol version, they will either have the messages pushed to them as available, or on modern protocols, they will thereafter receive DSQs over the inventory system. NOTE: I also refactor the code in this commit, moving some network proccessing into.... wait for it... net_processing.cpp! This allowed us to remove some dependencies in coinjoin.h. DSQ messages are now relayed to peers by calling peer_manager.RelayDSQ ## How Has This Been Tested? I have not yet mixed on testnet with this; we should include it in rc.2 and test ## Breaking Changes Slightly breaking for v22.0.x (so rc.1), as they in theory could be relying on this new logic of always receiving the DSQ inv. But I don't think anyone besides core is using this new protocol. ## Checklist: _Go over all the following points, and put an `x` in all the boxes that apply._ - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: UdjinM6: light ACK dafa736 kwvg: utACK dafa736 Tree-SHA512: 18f9b0dfe05cde19db451653db9bb9a00352efd1bc37adffd83f74958010475f2782b1111b1c0d2dd967e7a851c3c4795fa55033b4bd0cc810aa293e754ce314
Issue being fixed or feature implemented
DSQ messages are 142 bytes.
Previously, assuming a relatively highly connected masternode hosting 100 connection, each round of coinjoin will result in 14.2KB (100*142) of inbound and outbound traffic each.
What was done?
Now, using the inventory system, a message will first use 36 bytes per peer (sending and receiving), plus the size of a
getdata
message and the actual message itself. As a result, bandwidth usage for 1 round of mixing would be closer to 36 * 100 + 142 (dsq) + 36 (getdata) = ~3.8KB, a reduction of around ~73%How Has This Been Tested?
Has not been; @UdjinM6 especially please review well :)
Breaking Changes
Does introduce a new protocol version, but in a backwards compatible way. I don't think this would need to be delayed to v22 for any reason.
Checklist:
Go over all the following points, and put an
x
in all the boxes that apply.